package com.algrithom.tree.huffman;

import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

/**
 * 节点类
 *
 * @author think
 * @version 1.0.0
 */
@Setter
@Getter
@NoArgsConstructor
class HuffmanNode {
    
    /**
     * 树节点存储的关键字，如果是非叶子节点为空
     */
    private String key;
    
    /**
     * 关键字词频
     */
    private int frequency;
    
    /**
     * 左子节点
     */
    private HuffmanNode left;
    
    /**
     * 右子节点
     */
    private HuffmanNode right;
    
    /**
     * 优先级队列中指向下一个节点的引用
     */
    private HuffmanNode next;
    
    HuffmanNode(int fre){
        this.frequency = fre;
    }
    
    HuffmanNode(int fre,String str){
        this.frequency = fre;
        this.key = str;
    }
}
